]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
padOsd: Figure out label/edition UI positions from unchanged fonts
authorCarlos Garnacho <carlosg@gnome.org>
Sat, 30 Apr 2022 12:09:37 +0000 (14:09 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 2 Sep 2022 19:24:47 +0000 (19:24 +0000)
We can figure out the position to render the text without resorting to
font sizes that make the whole text element sub-pixel size. As the
original labels in the SVG are themed invisible anyway, calculate the
button/ring/strip label and configuration UI position from their unchanged
size/location.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5415
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2288>

data/theme/pad-osd.css
js/ui/padOsd.js

index 31c23772280de98467fcb1fe85818ec485d23684..e0c904847a4b624a72737f1a2741c5954d8f038b 100644 (file)
@@ -19,7 +19,6 @@
 .Label {
     stroke: none !important;
     stroke-width: .1 !important;
-    font-size: .1 !important;
     fill: transparent !important;
 }
 
index d0cbbe0e2fedcc11d79e2113a4ae16ad4ec840c0..e1e24f70cb62cba59dfea3f2a5ecfa993c001507 100644 (file)
@@ -485,23 +485,23 @@ var PadDiagram = GObject.registerClass({
         if (this._handle == null)
             return [false];
 
-        let leaderPos, leaderSize, pos;
-        let found, direction;
-
-        [found, pos] = this._handle.get_position_sub(`#${labelName}`);
-        if (!found)
+        const [labelFound, labelPos] = this._handle.get_position_sub(`#${labelName}`);
+        const [, labelSize] = this._handle.get_dimensions_sub(`#${labelName}`);
+        if (!labelFound)
             return [false];
 
-        [found, leaderPos] = this._handle.get_position_sub(`#${leaderName}`);
-        [found, leaderSize] = this._handle.get_dimensions_sub(`#${leaderName}`);
-        if (!found)
+        const [leaderFound, leaderPos] = this._handle.get_position_sub(`#${leaderName}`);
+        const [, leaderSize] = this._handle.get_dimensions_sub(`#${leaderName}`);
+        if (!leaderFound)
             return [false];
 
-        if (pos.x > leaderPos.x + leaderSize.width)
+        let direction;
+        if (labelPos.x > leaderPos.x + leaderSize.width)
             direction = LTR;
         else
             direction = RTL;
 
+        let pos = {x: labelPos.x, y: labelPos.y + labelSize.height};
         if (this.leftHanded) {
             direction = 1 - direction;
             pos.x = this._imageWidth - pos.x;